package practikasdelsalonn;

import java.util.*;
public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String l;
        int a;
        int b=0;
        int c;
        System.out.println("Introduce una cadena");
        String cad = sc.next();
        String [] ar=cad.split("-");

        for(int x=1;x<ar.length;x+=2){
           a=Integer.parseInt(ar[x]);
           if(a>b){
                b=a;
           }

        }
         String fin[] = new String[b];
        for(int k=0;k<ar.length;k+=2){
            l=ar[k+1];
            b=Integer.parseInt(l);
            fin[b-1]=ar[k];
        }
         for(int y=0;y<fin.length;y++){

             if(fin[y]==null){
                fin[y]=" ";
             }
             System.out.print("|"+fin[y]);

         }
    }

}


